package com.wthink.newMain.msg.inner.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.wthink.hzgj.data.domain.NoticeMsg
import com.wthink.hzgj.util.Log
import com.wthink.hzgj.util.PreferencesUtils

class UnReadedViewmodel : ViewModel(){

    val noticeMsgList = MutableLiveData(emptyList<NoticeMsg>())

    fun start(){
        var stringToArrryLists : MutableList<NoticeMsg> = mutableListOf()
        val stringToList = PreferencesUtils.stringToList()
        stringToList.forEachIndexed { index, noticeMsg ->
            if (!noticeMsg.readed) {
                stringToArrryLists.add(noticeMsg)
            }
        }

       // val sortedByDescending = stringToArrryLists.sortedByDescending { it.time }
        noticeMsgList.postValue(stringToArrryLists)
    }
}